{include file="public/header"}
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>回收站</title>
    <link rel="stylesheet" type="text/css" href="__CSS__/tt.css" />
    <style>
        html,body {
            width: 100%;
            background:rgba(238,238,238,1);
            max-height: 500px;
        }

        .container{
            padding-top:30px;
            padding-bottom:94px;
        }


        .box{
            width:1200px;
            height:auto;
            margin: 0 auto;
            padding-bottom:10px;
            background-color:#FFFFFF;
        }

        .box_1{
            padding-left:30px;
            padding-right:30px;
            height: 66px;
        }


        table{
            width:100%;
            padding-left:30px;
            padding-right:30px;
            text-align:left;
            border-spacing:0;
            color:#666666;
            font-size:12px;
        }

        th{
            height:50px;
            line-height:50px;
            background-color:#F7F7F7;
            word-wrap:break-word;
            /*padding-left: 2px;*/
            /*padding-right: 2px;*/
        }
        th:nth-child(1){
            padding-left:30px;
        }
        td{
            height:50px;
            line-height:50px;
            border-bottom:1px solid #E9E9E9;
            word-wrap:break-word;
            overflow: hidden;
        }
        .td_special{
            display: -webkit-box;
            overflow: hidden;
            text-overflow: ellipsis;
            word-wrap: break-word;
            word-break: break-all;
            white-space: normal !important;
            -webkit-line-clamp: 1;
            -webkit-box-orient: vertical;
        }
        .typeImg{
            /*margin-bottom: -10px;*/
        }
        td:nth-child(1){
            padding-left:30px;
        }
        td:hover{
            /*color: cornflowerblue;*/
            background: #F4FBFF;
        }
        .name111{
            width:24px;
            font-size:12px;
            font-weight:400;
            color:rgba(0,101,240,1);
            margin-right:7px;
            cursor: pointer;
        }

        .pagination{
            /*height: 28px !important;*/
            /*line-height:28px;*/
            /*margin-top:30px;*/
            /*padding-right:33px;*/
            color:#999;
            font-size:12px;
        }
        .pagination div{
            margin-left:5px;
            margin-right:5px;
        }
        .pagination div:nth-child(2){
            margin-right:15px;
        }
        .pagination div:nth-child(6){
            color:#282828;
        }
        .pagination div:nth-child(8){
            margin-left:15px;
        }

        .box_1Name{
            color: #4A4A4A;
            width:60px;
            font-size:14px;
            font-weight:400;
            line-height:66px;
            padding-right: 5px;
        }

        .inputttt{
            margin-top:19px;
            width:230px;
            height:28px;
            background:rgba(255,255,255,1);
            border-radius:3px;
            border:1px solid rgba(244,244,244,1);
            color:rgba(204,204,204,1);
            font-size:12px;
        }

        .inputrenwu {
            padding-left: 11px;
            box-sizing: border-box;
            display: inline-block !important;
            width: 200px !important;
            height: 28px !important;
            outline: none;
            border-width: 0;
        }

        .inputtttImg{
            width: 16px;
            height: 16px;
            margin-top:6px;
            margin-left:5px;
        }
        .selectttt22{
            margin-top:20px;
            margin-left:30px;
            width:68px;
            height:30px;
            background:dodgerblue;
            border-radius:3px;
            text-align: center;
            line-height:30px;
            font-size:12px;
            font-weight:400;
            color:rgba(255,255,255,1);
        }
        .selectfile{
            margin-top:20px;
            width:80px;
            height:30px;
            background:dodgerblue;
            border-radius:3px;
            text-align: center;
            line-height:30px;
            font-size:12px;
            font-weight:400;
            color:rgba(255,255,255,1);
        }
        .selectfile2{
            height:60px;
            width:78px;
            color: dodgerblue;
            background:#FFF;
            border: 1px solid deepskyblue;
            margin: 0;
            padding: 0;
        }
        .selectfile3{
            width:120px;
            height: 28px;
            margin-left: 10px;
            color: dodgerblue;
            background:#FFF;
            font-weight: bold;
            font-size: 14px;
            border: 1px solid deepskyblue;
        }
        /*.uploadfile{*/
            /*background-image:url('__IMG__/upload.png');*/
            /*background-size: auto;*/
        /*}*/
        .selectfileson{
            margin:0;
            cursor: pointer;
        }
        .selectfileson:hover{
            background: powderblue;
            margin: 0;
        }

        .selectttt3{
            margin-top:19px;
            width:50px;
            height:28px;
            background:rgba(0,101,240,1);
            border-radius:3px;
            text-align: center;
            line-height:28px;
            font-size:12px;
            font-weight:400;
            color:rgba(255,255,255,1);float: left;
        }
        .hidden{
            display: none
        }
    </style>
    <style>
        .btn-primary {
            background-color: #1ab394;
            border-color: #1ab394;
            color: #FFF;
        }
        .btn {
            border-radius: 3px;
        }
        .btn-block {
            display: block;
            margin: 0 auto;
            width: 100px;
        }
        .btn {
            display: inline-block;
            padding: 6px 12px;
            margin-bottom: 0;
            font-size: 14px;
            font-weight: normal;
            line-height: 1.42857143;
            text-align: center;
            white-space: nowrap;
            vertical-align: middle;
            -ms-touch-action: manipulation;
            touch-action: manipulation;
            cursor: pointer;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            background-image: none;
            border: 1px solid transparent;
            border-radius: 4px;
        }
    </style>
</head>
<body>
<!--<div class="tt_top3">-->
    <!--<div class="tt_top33">全部文件</div>-->
<!--</div>-->
<div class="container">
    <div class="box">
        {if condition="!$data->isEmpty()"}
            <div class="box_1 flex-wrap" style="float: right">
                <div class="selectfile selectfile3 hand_icon" onclick="returnBack('');">
                    <img src="__IMG__/goback.png" height="20" width="20" style="margin-top: -5px" /> 还原
                </div>

                <div class="selectfile uploadfile" onclick="delAll('');" style="margin-left: 50px;cursor: pointer;width: 120px;">
                    <img src="__IMG__/del.png" height="20" width="20" style="margin-top: -2px" /> 清空回收站
                </div>
            </div>
        {/if}
        <!--<div>-->
        <div class="box1" style="width: 100%;overflow-x: scroll;">
            <table style="width: 100%;overflow-x: scroll;">
                <tr>
                    <th><input type="checkbox" class="all_check" />&nbsp;&nbsp;文件名</th>
                    <th>大小</th>
                    <th>修改日期</th>
                    <th>操作</th>
                </tr>
                {if condition="!$data->isEmpty()"}
                {foreach name="data" item="vo"}
                <tr>
                    <td class="td_special">
                        <input type="checkbox" class="one_check" data-id="{$vo.uy_id}" />
                        &nbsp;&nbsp;
                        {if $vo.uy_type == 1}
                        <img class="typeImg" src="__IMG__/file.png" height="30" />
                        {elseif $vo.uy_type == 2}
                            {if stristr($vo.uy_url,'.pdf') || stristr($vo.uy_url,'.PDF')}
                            <img class="typeImg" src="__IMG__/pdf.png" height="30" />
                            {/if}
                            {if stristr($vo.uy_url,'.docx') || stristr($vo.uy_url,'.doc')}
                            <img class="typeImg" src="__IMG__/word.png" height="30" />
                            {/if}
                            {if stristr($vo.uy_url,'.xls') || stristr($vo.uy_url,'.xlsx')}
                            <img class="typeImg" src="__IMG__/xls.png" height="30" />
                            {/if}
                        {else /}
                        <img class="typeImg" src="__IMG__/png.png" height="30" />
                        {/if}
                        &nbsp;
                        <span style="cursor:default;">
                            {$vo.uy_name?:''}
                        </span>
                    </td>
                    <td>
                        {if $vo.uy_type == 1}
                        -
                        {else /}
                        {$vo.uy_size > 1024 ? round($vo.uy_size/1024,2) . 'M' : round($vo.uy_size) . 'K'}
                        {/if}
                    </td>
                    <td>{$vo.uy_update?:''}</td>
                    <td>
                        <span class="name111" onclick="returnBack({$vo.uy_id});">
                            <img src="__IMG__/goback.png" height="15" width="15" style="margin-top: -5px" />
                            还原
                        </span>
                        &nbsp;&nbsp;
                        <span class="name111" onclick="delAll({$vo.uy_id});">
                            <img src="__IMG__/delred.png" height="15" width="15" style="margin-top: -2px" />
                            删除
                        </span>
                    </td>
                </tr>
                {/foreach}
                {else/}
                <tr>
                    <td colspan="13" style="text-align: center;">暂无数据 ！</span></td>
                </tr>
                {/if}

            </table>
        </div>
        <!--</div>-->
        <ul class="pagination flex-con" style="display: flex;justify-content: flex-end;">
            {$data->render()}
        </ul>
    </div>
</div>
<input type="hidden" name="ids" id="ids" value="" />
<input type="hidden" name="typetype" id="typetype" value="" />
</body>
{include file="public/footer"}
<script type="text/javascript">
    /**
     * 还原（单个和批量）
     */
    function returnBack(id) {
        getOrderIds(); //每次进来都要先重算下id的值，以防出错
        if(id){ //单个直接赋值ids
            $('#ids').val(id);
        }
        var ids = $('#ids').val();
        if(ids == ''){
            alert('请至少选择一个！');
            return false;
        }else{
            if(confirm('确定要恢复吗？')){
                ajaxUse('/shop/Recycle/dataBack',ids)
            }
        }
    }
    /**
     * 删除（单个和所有）
     */
    function delAll(id) {
        if(id == ''){ //单个直接赋值ids
            id = -1;
        }
        if(confirm('确定要删除吗？')){
            ajaxUse('/shop/Recycle/delReal',id)
        }
    }
    function ajaxUse(url,ids) {
        $.ajax({
            url: url,
            data: 'ids='+ids,
            type: 'POST',
            dataType: 'JSON',
            success: function (returnData) {
//                alert(returnData.msg);
                if(returnData.code == 200){
                    location.reload();
                }
            },
            error: function () {
                alert('数据出错，请刷新重试');
            }
        })
    }
</script>

<script>
    /**
     * 点击全选
     */
    $('.all_check').click(function () {
        if($(this).prop('checked')){
            $('input:checkbox').prop('checked',true);
        }else{
            $('input:checkbox').prop('checked',false);
        }
        getOrderIds();
    });
    /**
     * 点击单个
     */
    $('.one_check').click(function () {
        var all_length = $('.one_check').length;
        var check_length = $('.one_check:checked').length;
        if($(this).prop('checked')){
            if(check_length >= all_length){
                $('.all_check').prop('checked',true);
            }
        }else{
            if(check_length < all_length){
                $('.all_check').prop('checked',false);
            }
        }
        getOrderIds();
    });
    /**
     * 获取选中的order_id
     */
    function getOrderIds() {
        var oids = '';
        $('.one_check:checked').each(function (i,d) {
            oids += $(d).attr('data-id')+',';
        });
        $('#ids').val(oids);
    }
</script>
